﻿<%@ Page Title="Change Password - Savory Housing" Language="C#" MasterPageFile="~/RealState.Master"
    AutoEventWireup="true" CodeBehind="Change_Password.aspx.cs" Inherits="WebApplication.ManageAccount.Change_Password" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script language="javascript" type="text/javascript">
        function CheckConfirmPassword() {
            var button = document.getElementById('MainContent_btn_Update');
            var result = true;
            var Password = document.getElementById('MainContent_txt_NewPassword');
            var ConfirmPassword = document.getElementById('MainContent_txt_ConfirmNewPassword');
            if (ConfirmPassword.value != Password.value) {
                document.getElementById('MainContent_txt_ConfirmNewPassword').value = "";
                document.getElementById('div_PasswordError').style.display = "block";
            }
            else {
                document.getElementById('div_PasswordError').style.display = "none";

            }
        }
        function CheckRequiredFields() {
            var OldPassord = document.getElementById('MainContent_txt_OldPassword');
            var Password = document.getElementById('MainContent_txt_NewPassword');
            var ConfirmPassword = document.getElementById('MainContent_txt_ConfirmNewPassword');
            if (OldPassord.value == '' || Password.value == '' || ConfirmPassword.value == '') {
                return false;

            }
            return true;
        }
        function checkPageValidity() {

            var result = true;

            if (result = CheckRequiredFields()) {
                document.getElementById('div_error').style.display = "none";
                return true;
            }
            else {
                document.getElementById('div_error').style.display = "block";
                document.getElementById('msg_bx1').innerHTML = '* marked fields are required.';
                return false;
            }
            return true;
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="content_container" style="margin-bottom: 0px !important;">
        <br />
        <!-- Admin Left Area Start -->
        <div class="admin-left">
            <ul>
                <li><a href="Account_Overview.aspx" class="active">My Account Overview</a></li>
                <li><a href="#">Manage Offers</a></li>
                <li><a href="#">Manage Requests</a></li>
            </ul>
        </div>
        <!-- Admin Left Area End -->
        <!-- Admin right area Start -->
        <div class="admin-right">
            <div class="error_box" id="div_error">
                <span class="fix_error" id="msg_bx1"></span>
                <br />
                <span class="error_description"></span>
            </div>
            <div id="div_UpdatePwdMsg" runat="server" style="display: none;">
                <h2 class="active_tick">
                    Your password is updated successfully.</h2>
            </div>
            <h1>
                Change Password</h1>
            <div class="sectionHeader">
                Account Information</div>
            <dl class="form clearfix">
                <dt>
                    <asp:TextBox ID="txt_OldPassword" runat="server" CssClass="form-text" placeholder="Old Password" TextMode="Password"></asp:TextBox>
                    <span class="red">*</span> </dt>
                <dt>
                    <asp:TextBox ID="txt_NewPassword" runat="server" CssClass="form-text" placeholder="New Password" TextMode="Password"></asp:TextBox>
                    <span class="red">*</span> </dt>
                <dt>
                    <asp:TextBox ID="txt_ConfirmNewPassword" runat="server" CssClass="form-text" placeholder="Confirm Password" TextMode="Password"  Onblur="CheckConfirmPassword();"></asp:TextBox>
                    <span class="red">*</span>                     
                    <div class="error_msg" id="div_PasswordError" style="display: none;">
                        <label class="errmsg_lbl">
                            Passwords do not match
                        </label>
                    </div>
                    </dt>
                <br />
                <asp:Button ID="btn_Update" runat="server" Text="Update" 
                    CssClass="reg-blue-round-btn w75" OnClientClick="return checkPageValidity();" 
                    onclick="btn_Update_Click" />
                </dt>
            </dl>
        </div>
        <!-- Admin right area End -->
        <div class="clear">
        </div>
    </div>
    </div>
</asp:Content>
